package com.matrix.java.chap_06;

/*
    数学：五角数
 */
public class Ex6_01 {
    public static void main(String[] args) {
        for (int i = 1; i <= 100; i++) {
            int pentagonalNumber = getPentagonalNumber(i);
            if (i % 10 == 0) {
                System.out.println(pentagonalNumber);
            } else {
                System.out.print(pentagonalNumber + " ");
            }
        }
    }

    private static int getPentagonalNumber(int n) {
        return (n * (3 * n - 1)) / 2;
    }
}
